"""
认证相关数据模型
"""

from typing import Optional
from pydantic import BaseModel, Field

class LoginRequest(BaseModel):
    """登录请求模型"""
    username: str = Field(..., description="用户名")
    password: str = Field(..., description="密码")

class RefreshTokenRequest(BaseModel):
    """刷新令牌请求模型"""
    refresh_token: str = Field(..., alias="refreshToken", description="刷新令牌")

class Token(BaseModel):
    """令牌响应模型"""
    access_token: str = Field(..., alias="token", description="访问令牌")
    refresh_token: str = Field(..., alias="refreshToken", description="刷新令牌")
    token_type: str = Field(default="bearer", description="令牌类型")
    expires_in: int = Field(..., alias="expiresIn", description="过期时间(秒)")

class TokenData(BaseModel):
    """令牌数据模型"""
    username: Optional[str] = None
    user_id: Optional[int] = None
    
class LoginResponse(BaseModel):
    """登录响应模型"""
    token: str = Field(..., description="访问令牌")
    refresh_token: str = Field(..., alias="refreshToken", description="刷新令牌")
    expires_in: int = Field(..., alias="expiresIn", description="过期时间(秒)")
    user: dict = Field(..., description="用户信息")